/*
 * Copyright (c) ShaoxiongDu <Shaoxiong.dev@aliyun.com> 2021 all Rights Reserved
 */

package zh.codegym.task.task07.task0718;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

/* 
检查顺序
*/

public class Solution {
    public static void main(String[] args) throws IOException {
        //在此编写你的代码
        ArrayList<String> list = new ArrayList<String>();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        for (int i = 0; i < 10; i++) {
            list.add(br.readLine());

        }

        int maxlen = 0;
        for (int i = 0; i < list.size(); i++) {
            int len = list.get(i).length();

            if (maxlen > len) {
                System.out.println(i);
                break;
            } else {
                maxlen = len;
            }
        }

    }
}

